/*
	i8259a.h
	
	8259A interrupt controller control code
	
	Meng Sun(c) leon.meng.sun@gmail.com
	Source code released under LGPLv3
	https://www.gnu.org/licenses/lgpl-3.0.txt
*/

#ifndef ISAMIPS_QEMU_I8259A
#define ISAMIPS_QEMU_I8259A

#include "board.h"

#define MASTER_I8259A_BASE ((unsigned char*)(ISA_IO_BASE + 0x20))
#define SLAVE_I8259A_BASE ((unsigned char*)(ISA_IO_BASE + 0xa0))

#define MASTER_ICW1 *(MASTER_I8259A_BASE)
#define MASTER_OCW2 *(MASTER_I8259A_BASE)
#define MASTER_OCW3 *(MASTER_I8259A_BASE)
#define MASTER_ICW2 *(MASTER_I8259A_BASE + 1)
#define MASTER_ICW3 *(MASTER_I8259A_BASE + 1)
#define MASTER_ICW4 *(MASTER_I8259A_BASE + 1)
#define MASTER_OCW1 *(MASTER_I8259A_BASE + 1)

#define SLAVE_ICW1 *(SLAVE_I8259A_BASE)
#define SLAVE_OCW3 *(SLAVE_I8259A_BASE)
#define SLAVE_OCW2 *(SLAVE_I8259A_BASE)
#define SLAVE_ICW2 *(SLAVE_I8259A_BASE + 1)
#define SLAVE_ICW3 *(SLAVE_I8259A_BASE + 1)
#define SLAVE_ICW4 *(SLAVE_I8259A_BASE + 1)
#define SLAVE_OCW1 *(SLAVE_I8259A_BASE + 1)

void i8259aInit(void);

void seti8250ISRCallback(void (*)(void));

void seti8254ISRCallback(void (*)(void));

#endif
